﻿@model IEnumerable<StudentPortal.PLAN_QUYDINH_DANGKY>

@{
    ViewBag.Title = "Index";
	Layout = "~/Views/Shared/_Layout.cshtml";
}

<div class="row-fluid">
	<div class="span12">

		<h2>Index</h2>

<p>
    @Html.ActionLink("Thêm", "Create", new { }, new { @class = "btn green" })
</p>
@(Html.Kendo().Grid<StudentPortal.PLAN_QUYDINH_DANGKY>()
	.Name("PLAN_QUYDINH_DANGKY")
	.Columns(columns =>
	{
			columns.Bound(model => model.Tu_ngay);
				columns.Bound(model => model.Den_ngay);
				columns.Bound(model => model.Hoc_ky);
				columns.Bound(model => model.Nam_hoc);
				columns.Bound(model => model.Chon_dang_ky);
				columns.Bound(model => model.STU_He.Ma_he);
				columns.Bound(model => model.STU_ChuyenNganh.Ma_chuyen_nganh);
				columns.Bound(model => model.PLAN_HocKyDangKy_TC.Nam_hoc);
				columns.Bound(model => model.Khoa_hoc);
				columns.Bound(model => model.Type);
		        columns.Command(command => {command.Custom("Sửa").Click("Edit"); command.Custom("Xóa").Click("Delete");});
	})
	.Groupable()
	.Pageable()
	.Sortable()
	.DataSource(
		dataSource => dataSource.Ajax()
			.Read(read => read.Action("Read", "QuyDinhDangKy"))
	)
)

	</div>
</div>
<script type="text/javascript">
	function Edit(e) {
		e.preventDefault();
		var dataItem = this.dataItem($(e.currentTarget).closest('tr'));
		location.href='@Url.Action("Edit","QuyDinhDangKy")/'+dataItem.ID;
	}
	function Delete(e) {
		e.preventDefault();
		var dataItem = this.dataItem($(e.currentTarget).closest('tr'));
		location.href = '@Url.Action("Delete","QuyDinhDangKy")/' + dataItem.ID;
	}
</script>
